import Vue from 'vue'
import VueRouter from 'vue-router'
import layoutView from '../views/layout/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../components/login.vue')
  },
  {
    path: '/home',
    name: 'home',
    component: layoutView,
    children: [
      {
        path: '/overView',
        name: 'overView',
        component: () => import( '../views/overView/index.vue')
      },
      {
        path: '/customerManagement',
        name: 'customerManagement',
        component: () => import( '../views/customerManagement/index.vue')
      },
      {
        path: '/potentialCustomers',
        name: 'potentialCustomers',
        component: () => import( '../views/potentialCustomers/index.vue')
      },
      {
        path: '/transactionManagement',
        name: 'transactionManagement',
        component: () => import( '../views/transactionManagement/index.vue')
      },
      {
        path: '/accountingReport',
        name: 'accountingReport',
        component: () => import( '../views/accountingReport/index.vue')
      },
      {
        path: '/cargoManagement',
        name: 'cargoManagement',
        component: () => import( '../views/cargoManagement/index.vue')
      },
      {
        path: '/afterSalesFollowUp',
        name: 'afterSalesFollowUp',
        component: () => import( '../views/afterSalesFollowUp/index.vue')
      },
      {
        path: '/user',
        name: 'user',
        component: () => import( '../views/user/index.vue')
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
